package com.conversationboard.controller;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.conversationboard.authenticator.AuthenticationCookie;
import com.conversationboard.config.Configuration;

@WebServlet(name = "DeleteCookiesControllerServlet", urlPatterns = "/DeleteCookiesControllerServlet")
public class DeleteCookiesControllerServlet extends HttpServlet {

	private static final long serialVersionUID = -1454146646416685888L;


	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

		request.setCharacterEncoding("UTF-8");
		response.setCharacterEncoding("UTF-8");

		if (!SecurityChecks.passes(request, this)) {
			return;
		}

		AuthenticationCookie.removeCookies(request, response);

		response.sendRedirect(Configuration.getInstance().getRoot() + "/index.jsp");

	}

}